<template>
  <div class="demo">
    <h1 class="demo1">学生名称:{{ name }}</h1>
    <h1 class="que">学生性别:{{ sex }}</h1>
    <button @click="sendStudentName">点我发送学生姓名至School</button>
  </div>
</template>
<script>
export default {
  name: "Student",
  data() {
    return {
      name: "陈嘉兴",
      sex: "男",
    };
  },
  methods:{
    sendStudentName() {
      this.$bus.$emit('studentName',this.name)
    }
  }
};
</script>

<style lang="less">
.demo {
  background-color: brown;
  .que {
    font-size: 70px;
  }
}
</style>